package com.example.testdemo.gradient_progress;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.example.testdemo.R;

/**
 * Created by 颜 on 04.12.012.
 * 渐变进度条
 */

public class GradientProgressActivity extends Activity {

    private TextView textView;
    private int progress;
    private GradientProgress progressBar1;
    private GradientProgress progressBar2;
    private GradientProgress progressBar3;
    private GradientProgress progressBar4;
    private GradientProgress progressBar5;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gradient_progress);
        textView = findViewById(R.id.text);
        progressBar1 = findViewById(R.id.progressBar1);
        progressBar2 = findViewById(R.id.progressBar2);
        progressBar3 = findViewById(R.id.progressBar3);
        progressBar4 = findViewById(R.id.progressBar4);
        progressBar5 = findViewById(R.id.progressBar5);
    }

    public void addProgress(View view) {
        if (progress == 100){
            progress = 0;
        }
        progress = progress + 1;
        progressBar1.setProgress(progress);
        progressBar2.setProgress(progress);
        progressBar3.setProgress(progress);
        progressBar4.setProgress(progress);
        progressBar5.setProgress(progress);
        textView.setText("当前进度：" + progress);
    }
}
